<!DOCTYPE html>






<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />


















  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="WebStorm," />










<meta name="description" content="写在前面的话  WebStorm是我最常用的IDE,从我开始学习前端到现在一直戒不掉它的动态补全和提示.  在我使用的过程中,不断的有新的需求,通过搜索和文档大部分都得到了解决,这里做一个简单的汇总. 资料WebStorm官方文档WebStorm中文文档WebStorm汉化包">
<meta name="keywords" content="WebStorm">
<meta property="og:type" content="article">
<meta property="og:title" content="WebStorm备忘">
<meta property="og:url" content="https://zhangyuhan2016.gitee.io/2017/12/12/WebStorm-note/index.html">
<meta property="og:site_name" content="zhangyuhan2016">
<meta property="og:description" content="写在前面的话  WebStorm是我最常用的IDE,从我开始学习前端到现在一直戒不掉它的动态补全和提示.  在我使用的过程中,不断的有新的需求,通过搜索和文档大部分都得到了解决,这里做一个简单的汇总. 资料WebStorm官方文档WebStorm中文文档WebStorm汉化包">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://zhangyuhan2016.gitee.io/images/webStorm-template.png">
<meta property="og:image" content="https://zhangyuhan2016.gitee.io/images/webStorm-sass.png">
<meta property="og:image" content="https://zhangyuhan2016.gitee.io/images/webStorm-file.png">
<meta property="og:updated_time" content="2018-01-29T03:49:12.076Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="WebStorm备忘">
<meta name="twitter:description" content="写在前面的话  WebStorm是我最常用的IDE,从我开始学习前端到现在一直戒不掉它的动态补全和提示.  在我使用的过程中,不断的有新的需求,通过搜索和文档大部分都得到了解决,这里做一个简单的汇总. 资料WebStorm官方文档WebStorm中文文档WebStorm汉化包">
<meta name="twitter:image" content="https://zhangyuhan2016.gitee.io/images/webStorm-template.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.3',
    sidebar: {"position":"right","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://zhangyuhan2016.gitee.io/2017/12/12/WebStorm-note/"/>





  <title>WebStorm备忘 | zhangyuhan2016</title>









</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<header style="position: fixed;z-index: 99999999;background-color: #eee;width: 100%;text-align: center;">
    <h3>感谢您的关注，最新博客已迁移至 <mark style="background-color: #07c160;padding: 4px;"><a style="color: #fff;" href="https://blog.hi-zhang.com" target="_blank">blog.hi-zhang.com</a></mark> </h3>
</header>






  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">


    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">zhangyuhan2016</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>

        <p class="site-subtitle"></p>

  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">



    <ul id="menu" class="menu">


        <li class="menu-item menu-item-home">
          <a href="/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />

            首页
          </a>
        </li>


        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />

            标签
          </a>
        </li>


        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />

            归档
          </a>
        </li>



    </ul>



</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">


  <div id="posts" class="posts-expand">








  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">



  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhangyuhan2016.gitee.io/2017/12/12/WebStorm-note/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="zhangyuhan2016">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://avatars3.githubusercontent.com/u/18086072?s=460&v=4">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="zhangyuhan2016">
    </span>


      <header class="post-header">



          <h1 class="post-title" itemprop="name headline">WebStorm备忘</h1>


        <div class="post-meta">
          <span class="post-time">

              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>

                <span class="post-meta-item-text">发表于</span>

              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-12T09:12:28+08:00">
                2017-12-12
              </time>



              <span class="post-meta-divider">|</span>



              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>

                <span class="post-meta-item-text">更新于&#58;</span>

              <time title="更新于" itemprop="dateModified" datetime="2018-01-29T11:49:12+08:00">
                2018-01-29
              </time>

          </span>





              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/12/12/WebStorm-note/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2017/12/12/WebStorm-note/" itemprop="commentCount"></span>
                </a>
              </span>





             <span id="/2017/12/12/WebStorm-note/" class="leancloud_visitors" data-flag-title="WebStorm备忘">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>

                 <span class="post-meta-item-text">阅读次数&#58;</span>

                 <span class="leancloud-visitors-count"></span>
             </span>





            <div class="post-wordcount">


                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>

                  <span class="post-meta-item-text">字数统计&#58;</span>

                <span title="字数统计">
                  382
                </span>



                <span class="post-meta-divider">|</span>



                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>

                  <span class="post-meta-item-text">阅读时长 &asymp;</span>

                <span title="阅读时长">
                  1
                </span>

            </div>




        </div>
      </header>





    <div class="post-body" itemprop="articleBody">





        <h2 id="写在前面的话"><a href="#写在前面的话" class="headerlink" title="写在前面的话"></a>写在前面的话</h2><p>  <a href="https://www.jetbrains.com/webstorm/" target="_blank" rel="noopener">WebStorm</a>是我最常用的IDE,从我开始学习前端到现在一直戒不掉它的动态补全和提示.<br>  在我使用的过程中,不断的有新的需求,通过搜索和文档大部分都得到了解决,这里做一个简单的汇总.</p>
<h2 id="资料"><a href="#资料" class="headerlink" title="资料"></a>资料</h2><h3 id="WebStorm官方文档"><a href="#WebStorm官方文档" class="headerlink" title="WebStorm官方文档"></a><a href="https://www.jetbrains.com/help/webstorm/meet-webstorm.html" target="_blank" rel="noopener">WebStorm官方文档</a></h3><h3 id="WebStorm中文文档"><a href="#WebStorm中文文档" class="headerlink" title="WebStorm中文文档"></a><a href="https://github.com/judasn/IntelliJ-IDEA-Tutorial" target="_blank" rel="noopener">WebStorm中文文档</a></h3><h3 id="WebStorm汉化包"><a href="#WebStorm汉化包" class="headerlink" title="WebStorm汉化包"></a><a href="https://github.com/ewen0930/WebStorm-Chinese" target="_blank" rel="noopener">WebStorm汉化包</a></h3><a id="more"></a>
<h2 id="记录"><a href="#记录" class="headerlink" title="记录"></a>记录</h2><h3 id="动态模板"><a href="#动态模板" class="headerlink" title="动态模板"></a>动态模板</h3><p> 通过查看动态模板可以帮助你更快捷的编写代码<br><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">'test'.log  按下 Tab</span><br><span class="line">// console.log('test')</span><br></pre></td></tr></table></figure></p>
<p> 通过下面的设置可以自定义动态模板,也可设置适用的文件范围<br><img src="/images/webStorm-template.png" alt="模板"></p>
<h3 id="sass预处理"><a href="#sass预处理" class="headerlink" title="sass预处理"></a>sass预处理</h3><p> 在没有搭建脚手架的时候,也可以把sass添加到IDE中,输出格式目录等也可以设置<br><img src="/images/webStorm-sass.png" alt="sass"></p>
<h3 id="文件模板"><a href="#文件模板" class="headerlink" title="文件模板"></a>文件模板</h3><p> 通过自定义文件模板可以在团队项目中初始化一些既定的规范,比如驼峰命名等<br><img src="/images/webStorm-file.png" alt="文件模板"></p>
<h3 id="宏"><a href="#宏" class="headerlink" title="宏"></a><a href="https://www.jetbrains.com/help/webstorm/using-macros-in-the-editor.html" target="_blank" rel="noopener">宏</a></h3><p> 宏(macro)的全称是宏指令(macroinstruction)，不太严格的说，<strong>宏是指把较长的指令序列用某种规则对应到较短的指令序列的规则或模式</strong>.</p>
<h3 id="本地历史记录"><a href="#本地历史记录" class="headerlink" title="本地历史记录"></a>本地历史记录</h3><p> Alt + Shift + C 可以看到最近的修改<br> 通过VCS菜单可以看到当前文件的历史记录,再也不用担心改错</p>
<h3 id="文件差异比较"><a href="#文件差异比较" class="headerlink" title="文件差异比较"></a>文件差异比较</h3><p> 选中需要比较的文件, Ctrl + D 可以与指定的文件对比</p>
<h3 id="安全写入"><a href="#安全写入" class="headerlink" title="安全写入"></a>安全写入</h3><p> 使用parceljs的时候遇到安全写入问题，导致热更新只执行一次 </p>


    </div>







      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">




      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/zfb.png" alt="zhangyuhan2016 支付宝"/>
        <p>支付宝</p>
      </div>




  </div>
</div>

      </div>




    <footer class="post-footer">

        <div class="post-tags">

            <a href="/tags/WebStorm/" rel="tag">WebStorm</a>

        </div>







        <div class="post-nav">
          <div class="post-nav-next post-nav-item">

              <a href="/2017/12/08/Hexo&Next/" rel="next" title="使用Hexo + Next搭建博客">
                <i class="fa fa-chevron-left"></i> 使用Hexo + Next搭建博客
              </a>

          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">

              <a href="/2017/12/14/new-Get/" rel="prev" title="new Get">
                new Get <i class="fa fa-chevron-right"></i>
              </a>

          </div>
        </div>




    </footer>
  </div>



  </article>



    <div class="post-spread">

    </div>
  </div>


          </div>






    <div class="comments" id="comments">
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    </div>





        </div>



  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">

    <div class="sidebar-inner">




        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>


      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">

              <img class="site-author-image" itemprop="image"
                src="https://avatars3.githubusercontent.com/u/18086072?s=460&v=4"
                alt="zhangyuhan2016" />

              <p class="site-author-name" itemprop="name">zhangyuhan2016</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">


              <div class="site-state-item site-state-posts">

                <a href="/archives/">

                  <span class="site-state-item-count">15</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>







              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">30</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>


          </nav>



          <div class="links-of-author motion-element">


                <span class="links-of-author-item">
                  <a href="https://github.com/zhangyuhan2016" target="_blank" title="GitHub">

                      <i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>


          </div>








        </div>
      </section>


      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">






              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#写在前面的话"><span class="nav-number">1.</span> <span class="nav-text"><a href="#&#x5199;&#x5728;&#x524D;&#x9762;&#x7684;&#x8BDD;" class="headerlink" title="&#x5199;&#x5728;&#x524D;&#x9762;&#x7684;&#x8BDD;"></a>&#x5199;&#x5728;&#x524D;&#x9762;&#x7684;&#x8BDD;</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#资料"><span class="nav-number">2.</span> <span class="nav-text"><a href="#&#x8D44;&#x6599;" class="headerlink" title="&#x8D44;&#x6599;"></a>&#x8D44;&#x6599;</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#WebStorm官方文档"><span class="nav-number">2.1.</span> <span class="nav-text"><a href="#WebStorm&#x5B98;&#x65B9;&#x6587;&#x6863;" class="headerlink" title="WebStorm&#x5B98;&#x65B9;&#x6587;&#x6863;"></a><a href="https://www.jetbrains.com/help/webstorm/meet-webstorm.html" target="_blank" rel="noopener">WebStorm&#x5B98;&#x65B9;&#x6587;&#x6863;</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#WebStorm中文文档"><span class="nav-number">2.2.</span> <span class="nav-text"><a href="#WebStorm&#x4E2D;&#x6587;&#x6587;&#x6863;" class="headerlink" title="WebStorm&#x4E2D;&#x6587;&#x6587;&#x6863;"></a><a href="https://github.com/judasn/IntelliJ-IDEA-Tutorial" target="_blank" rel="noopener">WebStorm&#x4E2D;&#x6587;&#x6587;&#x6863;</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#WebStorm汉化包"><span class="nav-number">2.3.</span> <span class="nav-text"><a href="#WebStorm&#x6C49;&#x5316;&#x5305;" class="headerlink" title="WebStorm&#x6C49;&#x5316;&#x5305;"></a><a href="https://github.com/ewen0930/WebStorm-Chinese" target="_blank" rel="noopener">WebStorm&#x6C49;&#x5316;&#x5305;</a></span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#记录"><span class="nav-number">3.</span> <span class="nav-text"><a href="#&#x8BB0;&#x5F55;" class="headerlink" title="&#x8BB0;&#x5F55;"></a>&#x8BB0;&#x5F55;</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#动态模板"><span class="nav-number">3.1.</span> <span class="nav-text"><a href="#&#x52A8;&#x6001;&#x6A21;&#x677F;" class="headerlink" title="&#x52A8;&#x6001;&#x6A21;&#x677F;"></a>&#x52A8;&#x6001;&#x6A21;&#x677F;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#sass预处理"><span class="nav-number">3.2.</span> <span class="nav-text"><a href="#sass&#x9884;&#x5904;&#x7406;" class="headerlink" title="sass&#x9884;&#x5904;&#x7406;"></a>sass&#x9884;&#x5904;&#x7406;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文件模板"><span class="nav-number">3.3.</span> <span class="nav-text"><a href="#&#x6587;&#x4EF6;&#x6A21;&#x677F;" class="headerlink" title="&#x6587;&#x4EF6;&#x6A21;&#x677F;"></a>&#x6587;&#x4EF6;&#x6A21;&#x677F;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#宏"><span class="nav-number">3.4.</span> <span class="nav-text"><a href="#&#x5B8F;" class="headerlink" title="&#x5B8F;"></a><a href="https://www.jetbrains.com/help/webstorm/using-macros-in-the-editor.html" target="_blank" rel="noopener">&#x5B8F;</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#本地历史记录"><span class="nav-number">3.5.</span> <span class="nav-text"><a href="#&#x672C;&#x5730;&#x5386;&#x53F2;&#x8BB0;&#x5F55;" class="headerlink" title="&#x672C;&#x5730;&#x5386;&#x53F2;&#x8BB0;&#x5F55;"></a>&#x672C;&#x5730;&#x5386;&#x53F2;&#x8BB0;&#x5F55;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文件差异比较"><span class="nav-number">3.6.</span> <span class="nav-text"><a href="#&#x6587;&#x4EF6;&#x5DEE;&#x5F02;&#x6BD4;&#x8F83;" class="headerlink" title="&#x6587;&#x4EF6;&#x5DEE;&#x5F02;&#x6BD4;&#x8F83;"></a>&#x6587;&#x4EF6;&#x5DEE;&#x5F02;&#x6BD4;&#x8F83;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安全写入"><span class="nav-number">3.7.</span> <span class="nav-text"><a href="#&#x5B89;&#x5168;&#x5199;&#x5165;" class="headerlink" title="&#x5B89;&#x5168;&#x5199;&#x5165;"></a>&#x5B89;&#x5168;&#x5199;&#x5165;</span></a></li></ol></li></ol></div>


          </div>
        </section>
      <!--/noindex-->




    </div>
    <div class="post-block page my-thanks">
        <div class="my-title">致谢</div>
        <div class="thanks">Hexo</div>
        <div class="thanks">Next & Gemini</div>
        <div class="thanks">Gitee</div>
    </div>
  </aside>



      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">









      </div>
    </footer>


      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>

      </div>




  </div>



<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>



























    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>




    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>




    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>




    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>




    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>




    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>




    <script type="text/javascript" src="/lib/three/three.min.js"></script>




    <script type="text/javascript" src="/lib/three/canvas_lines.min.js"></script>






  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>







  <script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>




  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>






  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>









      <script id="dsq-count-scr" src="https://.disqus.com/count.js" async></script>



      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'https://zhangyuhan2016.gitee.io/2017/12/12/WebStorm-note/';
          this.page.identifier = '2017/12/12/WebStorm-note/';
          this.page.title = 'WebStorm备忘';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>






























  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>

  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: false,
        appId: 'xxTmc7jwpAd2bWhmkKOI7IGY-gzGzoHsz',
        appKey: 'glPUiD8ljbJsKYhBg5E0ghII',
        placeholder: '说点什么呗 ヾﾉ≧∀≦)o',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>












  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("mpOMyFHLi7a5S0ka5mv3cz7C-gzGzoHsz", "3t0W0au9Mxf0lOGFDF8u89pc");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>
















</body>
</html>
